<!--课程中心列表子项组件-->
<template>
  <view class="entire">
    <image :src="course.resCover" class="picture" mode="aspectFill" />
    <view class="info">
      <view class="top">
        <view class="left">
          {{ course.resName }}
        </view>
      </view>
      <view class="bottom">
        <image style="width: 25rpx; height: 25rpx" src="/static/images/icons/icon_time.png" />
        <view style="width: 200rpx; margin-left: 5rpx">
          {{
            course.overTime === '0001-01-01T00:00:00' ? '长期有效' : course.overTime.split('T')[0]
          }}
        </view>
        <!--        todo 隐藏查看量-->
        <!--        <image style="width: 25rpx; height: 25rpx" src="/static/images/icons/icon_eye.png" />-->
        <!--        <view style="min-width: 100rpx; margin-left: 5rpx">{{ course.lookNum }}</view>-->
        <image
          v-if="course.isCollect == 0"
          style="width: 25rpx; height: 25rpx"
          src="/static/images/icons/icon_collect.png"
        />
        <image
          v-else
          style="width: 25rpx; height: 25rpx"
          src="/static/images/icons/icon_collection_on.jpg"
        />
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { SearchItem } from '@/service/search/search'

const props = defineProps<{
  course: SearchItem
}>()
const pageData = reactive({
  isLike: true,
})
</script>

<style scoped lang="scss">
.entire {
  width: 700rpx;
  height: 160rpx;
  background-color: white;
  border-radius: 15rpx;
  margin-left: 25rpx;
  margin-top: 30rpx;
  display: flex;
  .picture {
    width: 260rpx;
    height: 150rpx;
    margin-left: 5rpx;
    margin-top: 5rpx;
    border-radius: 15rpx;
  }
  .info {
    display: flex;
    width: 440rpx;
    height: 160rpx;
    flex-direction: column;
    justify-content: space-between;
    .top {
      display: flex;
      .left {
        font-size: 26rpx;
        padding-left: 20rpx;
        width: 340rpx;
        margin-top: 10rpx;
        font-weight: bold;
        //文字两行省略
        display: -webkit-box;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        white-space: normal;
        letter-spacing: 1rpx;
      }
      .right {
        width: 80rpx;
        height: 80rpx;
      }
    }
    .bottom {
      display: flex;
      height: 50rpx;
      align-items: center;
      font-size: 22rpx;
    }
  }
}
.entire:active {
  background-color: #f5f5f7;
}
</style>
